package com.example.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.bean.Book;

@RestController
// 加载配置文件中前缀为book的值,属性要提供getter、setter方法
public class DemoController {
	
	private Logger logger = LoggerFactory.getLogger(DemoController.class);
	
	@Autowired
	private Book book;

	@RequestMapping("/book")
	public String getBookInfo() {
		return "author is : " + book.getAuthor() + ",book name is :" + book.getName();
	}
	
	@RequestMapping("/log")
	public void sysoutLog(){
		logger.info("this is logger info");
		logger.debug("this is logger debug");
		logger.error("this is logger error");
		logger.warn("this is logger warn");
	}

}
